<table>
<tr>
<td valign="top">
<fieldset>
<legend>Background Information</legend>
{if $enc}
<table>
	<tr>
	  <td>Date of Encounter:</td>
	  <td>{$enc->get("date_of_treatment")}</td>
	</tr>
	<tr>
	  <td>Encounter Location:</td>
	  <td>{$enc->get("facility_name")}</td>
	</tr>
	<tr>
	  <td>Reason:</td>
	  <td>{$enc->get_encounter_reason_print()}</td>
	</tr>
	<tr>
	  <td>Treating Provider:</td>
	  <td>{$enc->get_treating_person_print()}</td>
	</tr>
	<tr>
	  <td>Procedures:</td>
	  <td>{$cpts}</td>
	</tr>
	<tr>
	  <td>Diagnoses:</td>
	  <td>{$icds}</td>
	</tr>
</table>
{else}
This referral is not associated with an encounter.
{/if}
</fieldset>
</td>
<td valign="top">
{if $request}
<script>
{literal}
function formSubmit(formId,contentId) {
     HTML_AJAX.formSubmit(formId, contentId);
}
</script>
{/literal}
<form action='{$base_uri}index.php/Referral/Fillout/{$formId}?requestId={$request->get('refRequest_id')}{if $returnTo}&returnTo={$returnTo}{/if}' id="ajaxForm{$formId}" method="post">
<input type="button" onClick="formSubmit('ajaxForm{$formId}','mainFormTarget');" value="Update" />
<input type="hidden" name="form_id" value="{$formId}" />
<input type="hidden" name="process" value="true" />
<input type="hidden" name="filloutType" value="participation" />
<fieldset>
<legend>Referral Visit Information</legend>
<table>
	<tr>
	  <td>Referral Visit Date:</td><td>{input type="date" name="referral_visit_adhoc_date"}</td>
	</tr>
	<tr>
	  <td>Referral Program:</td><td>{$parProg->get('name')}</td>
	</tr>
	<tr>
	  <td>Name of Practice:</td><td>{input type="string" name="referral_visit_adhoc_practice"}</td>
	</tr>
	<tr>
	  <td>Name of Specialist:</td><td>{input type="string" name="referral_visit_adhoc_specialist"}</td>
	</tr>
	<tr>
	  <td>Specialty:</td><td>{$request->get('refSpecialty')}</td>
	</tr>
</table>
</fieldset>
</form>
</td>
</tr>
<tr>
<td colspan="2">
<fieldset>
<legend>Coding Data</legend>
{$codingBlock}
</fieldset>
</td>
</tr>
<tr>
<td>
<fieldset><legend>Lab Orders (<a href="{link action="edit" controller="Labs" defaultArg="0"}externalId={$request->get('refRequest_id')}">Add</a>)</legend>
                {clni_grid datasource="Order_DS" arg1=$patientId arg2=$request->get('refRequest_id')}
                </fieldset>
{/if}
</td>
</tr>
</table>
